﻿using System.Collections.Generic;
using Jsdl.Domain.Intermediate;
using Newtonsoft.Json;

namespace Jsdl.Domain.Type
{
    public class JsdlType
	{
        /// <summary>Gets or sets the name of the type (or property). </summary>
		[JsonProperty(PropertyName = "name")]
		public string Name { get; set; }

        /// <summary>Gets the kind of the this type. </summary>
		[JsonIgnore]
		public string Type
		{
			get { return TypeRaw ?? "object"; }
		}

        [JsonProperty(PropertyName = "type")]
        public string TypeRaw { get; set; }

        /// <summary>Gets or sets the description of the type (or property). </summary>
		[JsonProperty(PropertyName = "description")]
		public string Description { get; set; }

        /// <summary>Gets or sets the properties of the type. </summary>
        [JsonProperty(PropertyName = "properties")]
		public Dictionary<string, JsdlProperty> Properties { get; set; }

        /// <summary>Gets or sets the type of an item in an array type. </summary>
		[JsonProperty(PropertyName = "items")]
		public JsdlType Items { get; set; }
	}
}